package com.csdj.music.controller;

import com.csdj.music.service.RankListService;
import com.csdj.music.vo.RankList;
import com.csdj.music.vo.RespBean;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName: RankListController
 * @Author: XuTao
 * @Description: 歌单评分控制器
 * @Date: 2023/3/13 15:53
 **/
@RestController
@Api(tags = "歌单评分控制器")
@RequestMapping("/songlist/star")
public class RankListController {
    @Autowired
    private RankListService rankListService;

    @ApiOperation(value = "添加评分")
    @PostMapping("/addrankList")
    public RespBean add(RankList rankList){
        return rankListService.insert(rankList);
    }

    /**
     * 计算平均分
     * @param songListId 歌单id
     * @return
     */
    @ApiOperation(value = "计算评分")
    @GetMapping("/rankList")
    public Object rankOfsongListId(Integer songListId){
        return rankListService.rankOfsongListId(songListId);
    }
}
